package cn.blossoming.test

import cn.blossoming.dao.repository.TipsRepository
import cn.blossoming.dao.repository.UserRepository
import org.junit.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.transaction.support.TransactionTemplate

class Move : BaseTest() {
    @Autowired lateinit var userRepository: UserRepository


    @Test
    fun userUpdate() {
        val all = userRepository.findAll()
        all.forEach {
            val tipsNum = it.tips.size
            it.tipsNum = tipsNum
            val videoNum = it.videos.size
            it.videoNum = videoNum
            it.phone = System.nanoTime().toString()
            userRepository.save(it)
        }


    }

    @Autowired lateinit var transactionTemplate: TransactionTemplate
    @Autowired lateinit var tipsRepository: TipsRepository
}